home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / std_unix / archive / text0084.txt < prev    next >
Encoding:
Text File  |  1993-07-06  |  2.3 KB  |  48 lines

  1. Submitted-by: guy@auspex.com (Guy Harris)
  2.  
  3. >In this case NFS is indeed the culprit; it breaks the 1003.1 behavior of
  4. >allowing an application to read() from a directory. This restriction is
  5. >arbitrary; the NFS protocol itself allows it.
  6.  
  7. The NFS *protocol* may allow it; however, it may be a pain for some NFS
  8. server to *implement* it (not all NFS servers run on top of UNIX; some
  9. may run on top of OSes that make it a pain to get at the raw data in the
  10. directory).
  11.  
  12. >In fact, when 1003.8 (POSIX Transparent File Access) sees the light of
  13. >publicationand legitimizes NFS under POSIX (so to speak), this restriction
  14. >will *have* to go away if one wishes to claim ones implementation conforms
  15. >to 1003.8.  Strictly conforming applications don't try to read() directories
  16. >with the assumption that they're doing something equivalent to readdir(),
  17. >since the standard doesn't say they can; however, a strictly-conforming
  18. >application is allowed to read() a directory for any purpose.
  19.  
  20. If 1003.8 refers to NFS at all, what will it say about the behavior of
  21. file systems mounted from non-POSIX-compliant NFS servers?  I suspect
  22. it'll have to say "you're on your own there, bucko", in which case
  23. suppliers of those servers are free to reject attempts to read from
  24. directories with the NFS READ request (rather than the NFS READDIR
  25. request).
  26.  
  27. Note also that a strictly-conforming application cannot, of course,
  28. assume that the data it reads from a directory will have any particular
  29. format, unless you either 1) use #ifdefs for the different directory
  30. formats on different file systems (and compensate for byte-order
  31. problems as well), 2) wire knowledge of certain formats into the
  32. application, or 3) make the application programmable enough that
  33. programs written under it have that knowledge wired into them.
  34.  
  35. (I.e., I suspect the sum total of POSIX-system-programmer misery will be
  36. increased infinitesimally, if it's increased at all, by just saying Thou
  37. Shalt Not Try To "read()" From Directories, Lest Thou Get An Error From
  38. "read()".
  39.  
  40. I also suspect that having NFS client implementations reject requests to
  41. "read()" from directories will result in more broken programs - e.g.,
  42. programs that don't use "opendir()", "readdir()", and company - being
  43. caught and, hopefully, fixed.)
  44.  
  45.  
  46. Volume-Number: Volume 31, Number 86
  47.  
  48.